home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / ownrdclb / focus.frm < prev    next >
Text File  |  1998-05-17  |  3KB  |  127 lines

  1. VERSION 5.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "Form1"
  4.    ClientHeight    =   7125
  5.    ClientLeft      =   4785
  6.    ClientTop       =   2220
  7.    ClientWidth     =   6585
  8.    LinkTopic       =   "Form1"
  9.    ScaleHeight     =   7125
  10.    ScaleWidth      =   6585
  11.    Begin VB.ComboBox cboReal 
  12.       Height          =   315
  13.       Left            =   420
  14.       TabIndex        =   6
  15.       Text            =   "Combo1"
  16.       Top             =   360
  17.       Width           =   2655
  18.    End
  19.    Begin VB.CommandButton Command1 
  20.       Caption         =   "Command1"
  21.       Height          =   375
  22.       Left            =   480
  23.       TabIndex        =   5
  24.       Top             =   3360
  25.       Width           =   1395
  26.    End
  27.    Begin VB.PictureBox cboThis 
  28.       Height          =   375
  29.       Index           =   0
  30.       Left            =   420
  31.       ScaleHeight     =   315
  32.       ScaleWidth      =   2595
  33.       TabIndex        =   0
  34.       Top             =   780
  35.       Width           =   2655
  36.    End
  37.    Begin VB.PictureBox cboThis 
  38.       Height          =   375
  39.       Index           =   1
  40.       Left            =   420
  41.       ScaleHeight     =   315
  42.       ScaleWidth      =   2595
  43.       TabIndex        =   1
  44.       Top             =   1260
  45.       Width           =   2655
  46.    End
  47.    Begin VB.PictureBox cboThis 
  48.       Height          =   375
  49.       Index           =   2
  50.       Left            =   420
  51.       ScaleHeight     =   315
  52.       ScaleWidth      =   2595
  53.       TabIndex        =   2
  54.       Top             =   1740
  55.       Width           =   2655
  56.    End
  57.    Begin VB.PictureBox cboThis 
  58.       Height          =   375
  59.       Index           =   3
  60.       Left            =   420
  61.       ScaleHeight     =   315
  62.       ScaleWidth      =   2595
  63.       TabIndex        =   3
  64.       Top             =   2220
  65.       Width           =   2655
  66.    End
  67.    Begin VB.PictureBox cboThis 
  68.       Height          =   375
  69.       Index           =   4
  70.       Left            =   420
  71.       ScaleHeight     =   315
  72.       ScaleWidth      =   2595
  73.       TabIndex        =   4
  74.       Top             =   2700
  75.       Width           =   2655
  76.    End
  77. End
  78. Attribute VB_Name = "Form1"
  79. Attribute VB_GlobalNameSpace = False
  80. Attribute VB_Creatable = False
  81. Attribute VB_PredeclaredId = True
  82. Attribute VB_Exposed = False
  83. Option Explicit
  84.  
  85. Private Sub cboReal_KeyPress(KeyAscii As Integer)
  86. If (KeyAscii >= Asc("a") And KeyAscii <= Asc("b")) Then
  87.    KeyAscii = Asc(UCase$(Chr$(KeyAscii)))
  88. End If
  89. End Sub
  90.  
  91. Private Sub cboThis_KeyPress(Index As Integer, KeyAscii As Integer)
  92. If (KeyAscii >= Asc("a") And KeyAscii <= Asc("b")) Then
  93.    KeyAscii = Asc(UCase$(Chr$(KeyAscii)))
  94. End If
  95. End Sub
  96.  
  97. Private Sub Command1_Click()
  98. Dim i As Long
  99. Dim lW As Long
  100.     If (cboThis(0).Width = 2655) Then
  101.         lW = Me.ScaleWidth - cboThis(i).Left * 2
  102.     Else
  103.         lW = 2655
  104.     End If
  105.     For i = 0 To cboThis.UBound
  106.         cboThis(i).Width = lW
  107.     Next i
  108. End Sub
  109.  
  110.  
  111. Private Sub Form_Load()
  112. Dim i As Integer, l As Long
  113.     For i = 0 To cboThis.UBound
  114.         AddItems cboThis(i)
  115.     Next i
  116.    For l = 1 To 100
  117.       cboReal.AddItem "Item:" & l
  118.    Next l
  119. End Sub
  120. Private Sub AddItems(cboThis As OwnerDrawComboList)
  121. Dim l As Long
  122.     For l = 1 To 100
  123.         cboThis.AddItemAndData "Item:" & l & " & for testing ampersand", , (l Mod 3) * 8
  124.     Next l
  125.     cboThis.ListIndex = 0
  126. End Sub
  127.